<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // function max(a, b) {
        //     max = 0
        //     a > b ? max = a : max = b;
        //     document.write('最大值：' + max)
        //     return max
        // }
        // console.log(max(+prompt("输入第一个数a"), +prompt("输入第二个数b")));


        function Max(arr = []) {
            let max = arr[0]
            for (let i = 0; i < arr.length; i++) {
                arr[i] > max ? max = arr[i] : max = max
            }
            return max
        }
        function Min(arr = []) {
            let min = arr[0]
            for (let i = 0; i < arr.length; i++) {
                arr[i] < min ? min = arr[i] : min = min
            }
            return min
        }
        document.write('最大值：' + Max([20, 25, 61, 53, 15]))
        document.write('<br>最小值：' + Min([20, 25, 61, 53, 15]))
    </script>
</body>

</html>